{% extends 'home.html' %}

{% block content %}

    <div class="panel panel-primary">
        <div class="panel-heading"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增校准</div>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="location.href='/kfc/'">
                        <div class="card-body">
                            <h4 class="card-title">卡尔费休库仑法校准</h4>
                            <p class="card-text">KFC</p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="location.href='/kfv/'">
                        <div class="card-body">
                            <h4 class="card-title">卡尔费休容量法水分测定仪</h4>
                            <p class="card-text">KFV</p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="showDWYForm()">
                        <div class="card-body">
                            <h4 class="card-title">电位滴定仪校准</h4>
                            <p class="card-text">DWY</p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="location.href='/ph/'">
                        <div class="card-body">
                            <h4 class="card-title">PH校准</h4>
                            <p class="card-text"></p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="location.href='/hma/'">
                        <div class="card-body">
                            <h4 class="card-title">烘干法水分测定仪校准</h4>
                            <p class="card-text">HMA</p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="location.href='/lz/'">
                        <div class="card-body">
                            <h4 class="card-title">离子计校准</h4>
                            <p class="card-text">LZ</p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-6" style="display: flex; justify-content: center;">
                    <div class="card text-center card-button" onclick="location.href='/ddl/'">
                        <div class="card-body">
                            <h4 class="card-title">电导率仪校准</h4>
                            <p class="card-text">DDL</p>
                            <button class="btn btn-primary btn-card"><span class="glyphicon glyphicon-plus"></span> 新建</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 美化后的按钮布局 -->


    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title h4" id="myModalLabel">请输入参数</h4>
                </div>
                <div class="modal-body">

                    <form id="myform">
                        <div class="form-group">
                            <label>电极接口数量</label>
                            <input class="form-control" name="sensor" placeholder="请输入电极接口数量" value="1">
                        </div>
                        <div class="form-group">
                            <label>滴定管数量</label>
                            <input class="form-control" name="ddg"
                                   placeholder="请输入滴定管数量" value="1">
                        </div>

                    </form>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="conform" onclick="confirmAdd()">确定</button>
                </div>
            </div>
        </div>
    </div>

    <style>
        /* 添加METTLER TOLEDO背景 */
        .panel-body {
            position: relative;
            overflow: hidden;
        }
        
        .panel-body::before {
            content: "METTLER TOLEDO";
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) rotate(-30deg);
            font-size: 60px;
            font-weight: bold;
            color: rgba(173, 216, 230, 0.1);
            white-space: nowrap;
            z-index: 0;
            pointer-events: none;
        }
        
        .panel-body > div {
            position: relative;
            z-index: 1;
        }
        
        .card-button {
            margin: 15px;
            padding: 20px 15px;
            border-radius: 12px;
            box-shadow: 0 6px 16px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
            background: linear-gradient(135deg, #f0fff0 0%, #e0f0e0 100%); /* 浅绿色渐变背景 */
            border: 1px solid #c1e0c1;
            cursor: pointer;
            width: 100%;
            max-width: 260px;
            height: 180px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            position: relative;
            overflow: hidden;
        }
        
        .card-button:before {
            content: "";
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
            transform: rotate(30deg);
            z-index: 0;
        }
        
        .card-button:hover {
            transform: translateY(-8px) scale(1.02);
            box-shadow: 0 12px 24px rgba(0,0,0,0.15);
            border-color: #337ab7;
            background: linear-gradient(135deg, #e8f8e8 0%, #d0e8d0 100%);
        }
        
        .card-button .card-body {
            position: relative;
            z-index: 1;
        }
        
        .btn-card {
            padding: 8px 20px;
            font-size: 15px;
            border-radius: 25px;
            margin-top: 15px;
            background: linear-gradient(135deg, #337ab7 0%, #286090 100%);
            border: none;
            box-shadow: 0 4px 8px rgba(51, 122, 183, 0.3);
            transition: all 0.3s ease;
            font-weight: 500;
        }
        
        .btn-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(51, 122, 183, 0.4);
            background: linear-gradient(135deg, #286090 0%, #337ab7 100%);
        }
        
        .card-title {
            color: #2c3e50;
            margin-bottom: 10px;
            font-size: 18px;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
        }
        
        .card-text {
            color: #3498db;
            margin-bottom: 15px;
            font-size: 16px;
            font-weight: 700;
            letter-spacing: 1px;
        }
        
        .modal-header {
            background: linear-gradient(135deg, #337ab7 0%, #286090 100%);
            color: white;
            border-top-left-radius: 5px;
            border-top-right-radius: 5px;
        }
        
        .panel-body {
            padding: 20px;
            background: linear-gradient(to bottom, #f9f9f9 0%, #f1f1f1 100%);
        }
        
        .panel-heading {
            font-weight: bold;
            background: linear-gradient(135deg, #337ab7 0%, #286090 100%);
        }
    </style>

{% endblock %}


{% block js %}
    <script>
        function showDWYForm() {
            // 创建一个简单的弹窗
            var sensor = prompt("请输入电极接口数量:", "1");
            if (sensor !== null) {
                var ddg = prompt("请输入滴定管数量:", "1");
                if (ddg !== null) {
                    // 直接跳转到 dwy 路径，传递参数
                    location.href = '/dwy/?sensor=' + sensor + '&ddg=' + ddg;
                }
            }
        }
        
        function confirmAdd() {
            //获取数据
            var data = $('#myform').serialize();
            console.log(data)
            // 直接跳转到 dwy 路径，传递参数
            location.href = '/dwy/?' + data;
        }
    </script>
{% endblock %}